home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / graphics / library / wgt51_r2.zip / WGT5 / EXAMPLES / WGT21.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-03  |  2.1 KB  |  71 lines

  1. /*
  2. ==============================================================================
  3.                       WordUp Graphics Toolkit Version 5.0                     
  4.                              Demonstration Program 21                         
  5.                                                                               
  6.   Shows off some special FX using wvertres.                                   
  7.                                                                               
  8.   *** PROJECT ***                                                             
  9.   This program requires the file WGT5_WC.LIB to be linked.                    
  10.                                                                               
  11.   *** DATA FILES ***                                                          
  12.   Make sure that WGT1.PCX, and WGT2.PCX are in your executable dir.  
  13.                                                            WATCOM C++ VERSION 
  14. ==============================================================================
  15. */
  16.  
  17. #include <conio.h>
  18. #include <stdio.h>
  19. #include <wgt5.h>
  20.  
  21. void crush (block, block, short);
  22.  
  23. block screen1, screen2;          /* two virtual screens */
  24.  
  25. short oldmode;
  26. short y, s;
  27. color palette[256];
  28.  
  29. void main (void)
  30. {
  31.   if ( !vgadetected () )
  32.   {
  33.     printf ("Error - VGA card required for any WGT program.\n");
  34.     exit (0);
  35.   }
  36.   printf ("WGT Example #21\n\n");
  37.   printf ("This program will repeatedly crush two screens until a key is pressed.\n");
  38.   printf ("\n\nPress any key to continue.\n");
  39.   getch ();
  40.  
  41.   oldmode = wgetmode ();
  42.   vga256 ();
  43.  
  44.   screen1 = wloadpcx ("wgt1.pcx", palette);
  45.   screen2 = wloadpcx ("wgt2.pcx", palette);
  46.   wsetpalette (0, 255, palette);
  47.   wputblock (0, 0, screen1, 0);
  48.  
  49.   do {
  50.     crush (screen1, screen2, 5);
  51.     crush (screen2, screen1, 5);
  52.   } while (!kbhit ());
  53.  
  54.   wfreeblock (screen1);  /* remember to free that memory */
  55.   wfreeblock (screen2);
  56.   wsetmode (oldmode);
  57. }
  58.  
  59.  
  60. void crush (block b1, block b2, short dir)
  61. {
  62.   short q, w, e;
  63.  
  64.   for (q = 199; q >= 0; q -= dir)
  65.   {
  66.     wretrace ();
  67.     wvertres (0, 0, q, b1);
  68.     wvertres (0, q, 199, b2);
  69.   }
  70. }
  71.